home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
util
/
Mac F2C 1.3.sit
/
Mac F2C 1.3
/
Mac F2C Libraries
/
libF77 Sources
/
pow_hh.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-28
|
401b
|
32 lines
#include "f2c.h"
#ifdef KR_headers
shortint pow_hh(ap, bp) shortint *ap, *bp;
#else
shortint pow_hh(shortint *ap, shortint *bp)
#endif
{
shortint pow, x, n;
x = *ap;
n = *bp;
if (n <= 0) {
if (n == 0 || x == 1)
return 1;
if (x != -1)
return x == 0 ? 1/x : 0;
n = -n;
}
for(pow = 1; ; )
{
if(n & 01)
pow *= x;
if(n >>= 1)
x *= x;
else
break;
}
return(pow);
}